package com.cohen.basiccalculator;
import java.util.Scanner;

public class main {

	public static void main(String[] args) {
		Scanner input = new Scanner ( System.in );
		boolean hasRun = false;
		String keepGoing = "y";
		do {
			if (hasRun == true){
				System.out.println("Continue? y/n");
				keepGoing = input.next();
			}
			if (keepGoing.equals("n") == false && keepGoing.equals("y") == true){
				System.out.println("Please input first opperand. Numbers only please.");
				double n1 = input.nextDouble();
				System.out.println("Please input second opperand. Numbers only please.");
				double n2 = input.nextDouble();
				System.out.println("Please input an opperation.");
				String opp = input.next();
				if (opp.equals("+") == true){
					System.out.println(n1 + " " + opp + " " + n2 + " = " + (n1 + n2));
				} else if (opp.equals("-") == true){
					System.out.println(n1 + " " + opp + " " + n2 + " = " + (n1 - n2));
				} else if (opp.equals("*") == true){
					System.out.println(n1 + " " + opp + " " + n2 + " = " + (n1 * n2));
				} else if (opp.equals("/") == true){
					System.out.println(n1 + " " + opp + " " + n2 + " = " + (n1 / n2));
				} else {
					System.out.println("'" + opp + "' is not a valid opperation.");
				}
				hasRun = true;
			} else if (keepGoing.equals("n") == false){
				System.out.println("A child knows the difference between '" + keepGoing + "' and the letters 'y' and 'n,'");
				System.out.println("I hope the same can be said of you.");
			}
		} while ( keepGoing.equals("n") == false );
		System.out.println("Calculator terminated. Have a nice day.");
	}
}